
import os
import json
# import imghdr
import re
import random

# import datetime
# st = round(datetime.datetime.now().timestamp()*10**6)
# print(st)
# aa,bb = ['czh','xyt']
# print(aa,bb)
path = 'D:\\project\\project_5\\baidu_picture\\古代弓弩_3'
list_name = os.listdir(path)
for p,name in enumerate(list_name):
    rename = name.split('.')[0] + '0' + str(p) + '.jpg'
    os.chdir(path)
    os.rename(name,rename)

# file_ = 'D:\\wo\\ai\\czh'
# try:
#     os.makedirs(file_)
# except FileExistsError:
#     pass
# st = "[instance: 719832a5-1b99-41ab-81a2-4c9bc9c84e39] " "Attempting claim: memory 2048 MB, disk 20 GB, vcpus 1 CPU"
#
# a = re.findall(r"[^0-9\[:][A-Za-z]{2,}[^0-9\[:]",st)
# d = re.findall(r"\d+[A-Za-z-]+[0-9\]:]+[A-Za-z-]*|\d+|\s|\[|:",st)
# re_li = ['MB', 'claim', 'instance',
#          'memory', 'CPU', 'Attempting', 'vcpus', 'disk', 'GB']
# b = re.sub('\d+[A-Za-z-]+[0-9\]:]+[A-Za-z-]*|\d+|\s|\[|:|-|,','*',st)
#
# print(a)
# print(d)
# print(b)
# li = [1,'c',2,3,4,5,6,'a','b']
# ram = random.randint(0, len(li))
# a = li.pop()
#
# for i in range(len(li)):
#     print(li.pop())
